package com.sc.nft.entity.vo;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.sc.nft.enums.CopyrightCollectionDetailsAuctionStatusEnum;
import com.sc.nft.enums.MarketTypeEnum;
import com.sc.nft.enums.UserCollectionFreezingStatusEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

@Data
public class MyCopyrightCollectionDetailsVO {

    @ApiModelProperty("一级标题")
    private String firstTitle;

    @ApiModelProperty("拥有的藏品id")
    private Long id;

    @ApiModelProperty("详情页图")
    private String productDetailPicture;

    @ApiModelProperty("详情页图类型 1 图片 2:动图 3:3d模型")
    private Integer productDetailPictureType;

    @ApiModelProperty("售卖数量")
    private Integer productCount;

    @ApiModelProperty("产品介绍")
    private String productPresentation;

    @ApiModelProperty("作者昵称")
    private String nickName;

    @ApiModelProperty("作者头像")
    private String creatorAvatarImg;

    @ApiModelProperty("购买须知")
    private String purchaseNotes;

    @ApiModelProperty("系列名称")
    private String catenaName;

    @ApiModelProperty("权益介绍")
    private String privilegePresentation;

//    @ApiModelProperty("购入价格")
//    private String buyPrice;

//    @ApiModelProperty("最新成交价")
//    private String newPrice;

    @ApiModelProperty("流通数量")
    private Integer circulationNum;

    @ApiModelProperty("流转次数")
    private Integer circulationCount;

    @ApiModelProperty("是否可以转赠")
    private Boolean isGive;

//    @ApiModelProperty("特殊转增标识")
//    private Boolean isSpecialGive;

    @ApiModelProperty("上链状态 0:上链中 1:已上链 2:已下链")
    private Integer chainStatus;

    @ApiModelProperty("倒计时 (毫秒值)")
    private Long countdown;

    @ApiModelProperty("藏品编号")
    private String numbering;

    @ApiModelProperty("3d模型id")
    private String threeModelId;

    @ApiModelProperty("缩略图")
    private String creationContent;

    @ApiModelProperty("合约地址")
    private String contractAddress;

//    @ApiModelProperty("允许寄售的藏品")
//    private Boolean allowConsign;

//    @ApiModelProperty("是否可以取消")
//    private Boolean isCancel;

    @ApiModelProperty("是否是交易确认中")
    private Boolean isTrade;

//    @ApiModelProperty("发行价格")
//    private String issuePrice;

    @ApiModelProperty("藏品id")
    private Long collectionId;

//    @ApiModelProperty("销售金额")
//    private String salesPrice;

    @ApiModelProperty("3D模型贴图")
    private String modelImg;

    @ApiModelProperty("3D模型距离")
    private String modelDistance;

    @ApiModelProperty("链地址")
    private String chainUrl;

    @ApiModelProperty("区块链浏览器")
    private String tianheChain;

    @ApiModelProperty("跳转详情")
    private String skipUrl;

    @ApiModelProperty("藏品质押状态 NORMAL:正常 VERY_ACTIVE:激活中 PRESSING:质押中")
    private UserCollectionFreezingStatusEnum freezingStatus;


//    @ApiModelProperty("是否可以核销")
//    private Boolean canWriteOff;

    @ApiModelProperty("是否为仅熔炼")
    private Boolean isSmeltingOnly;

    @ApiModelProperty("是否锁仓")
    private Boolean isLockedPosition=Boolean.FALSE;

    @ApiModelProperty("锁仓描述")
    private String lockedPositionDescribe;

    @ApiModelProperty("锁仓到期日期")
    @JsonIgnore
    private Date lockedPositionTime;

    @ApiModelProperty("是否为充值类的藏品.只作为这个作用")
    private Boolean topUpStatus;

    @ApiModelProperty("市场分类 :1:品牌孵化 2:自由市场")
    private MarketTypeEnum marketType;

//    @ApiModelProperty("是否共识藏品")
//    private Boolean isConsensusCollection;
//    @ApiModelProperty("共识度")
//    private String consensusNum;

    public void setLockedPositionTime(Date lockedPositionTime) {
        this.lockedPositionTime=lockedPositionTime;
        // 当前日期大于锁仓日期,那么就是已经到期了 是否锁仓字段给false.如果小于的话,给true.并且说明 锁仓到期时间
        if (lockedPositionTime != null) {
            if (this.lockedPositionTime.getTime() < System.currentTimeMillis()) {
                this.isLockedPosition = false;
                this.lockedPositionDescribe = "锁仓已到期";
            } else {
                this.isLockedPosition = true;
                this.lockedPositionDescribe = StrUtil.format("锁仓结束时间: {}", DateUtil.format(this.lockedPositionTime, "yyyy-MM-dd HH:mm:ss"));
            }
        } else {
            this.isLockedPosition = false;
        }
    }

    //操作按钮状态
    @ApiModelProperty(value = "REGISTRATION 报名竞拍活动 ,UPDATE_START_PRICE 修改起拍价 ,AUCTION_IS_UNDERWAY 竞拍中 ,EQUITY_IN_EFFECT 权益生效中")
    private CopyrightCollectionDetailsAuctionStatusEnum buttonStatus;

}